
public enum Element 
{   
    // we really only need its strength
    Water(Elem.Fire),
    Fire(Elem.Earth),
    Earth(Elem.Lightning),
    Lightning(Elem.Water),
    Unknown (null); 
    
    // internal enum so we can declare the types 
    // strength in the initializer
    private enum Elem
    {
        Water,
        Lightning,
        Fire,
        Earth,
    };
    
    private Elem strength;
    
    Element(Elem strength) 
    {
        this.strength = strength;
    }

    public Element strength() 
    {
        if(this.strength == Elem.Fire)
        {
            return Element.Fire;
        }
        if(this.strength == Elem.Water)
        {
            return Element.Water;
        }
        if(this.strength == Elem.Earth)
        {
            return Element.Earth;
        }
        if(this.strength == Elem.Lightning)
        {
            return Element.Lightning;
        }
        return null; 
    }
    
    static double damageModifier(
            Element attacker, Element attackee)
    {
        if(attacker == null || attackee == null)
        {
            return 1;
        }
        if(attackee == attacker.strength())
        {
            return 1.5;
        }
        
        if(attackee.strength() == attacker)
        {
            return 0.5;
        }           
        return 1;
    }
}
